package com.ssmTest.service.impl;

import com.ssmTest.dao.ISecondHandDao;
import com.ssmTest.model.SecondHand;
import com.ssmTest.service.ISecondHandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("secondHandService")
public class SecondHangServiceImpl implements ISecondHandService {
    @Autowired
    ISecondHandService iSecondHandService;
    @Resource
    ISecondHandDao iSecondHandDao;

    //二手物品列表
    public List<SecondHand> SecondHandList(int toexamine) {
        return this.iSecondHandDao.SecondHandList(toexamine);
    }

    public void insertSecondHand(SecondHand secondHand){
        this.iSecondHandDao.insertSecondHand(secondHand);
    }
    public void updateInformation(SecondHand secondHand){
        this.iSecondHandDao.updateInformation(secondHand);
    }

    public SecondHand selectSecondHand(int id){
        return this.iSecondHandDao.selectSecondHand(id);
    }

    //关键字查询
    public List<SecondHand> selectSecondByAndName(int pagenum,String city,String name){
        List<SecondHand> list= iSecondHandDao.selectSecondByAndName((pagenum-1)*10,pagenum*10,city,name);
        return list;
    }

    public List<SecondHand> selectSecondByNoName(int pagenum,String city){
        List<SecondHand> list= iSecondHandDao.selectSecondByNoName((pagenum-1)*10,pagenum*10,city);
        return list;
    }
    public List<SecondHand> selectByPersionalId(int personal_id){
        return this.iSecondHandDao.selectByPersionalId(personal_id);
    }
}
